import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

function resolve(dir) {
  return path.join(__dirname, dir)
}
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 9528,
    host: '0.0.0.0',
    proxy: {
      '/prod-api': { // 本地代理，
        target: 'http://localhost:9531/prod-api',
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/prod-api/, '')
      }
    }
  },
  resolve: {
    alias: {
      '@': resolve('src')
    }
  }
})
